{include file="admin/header.html} 
<div class="title">
    <h3>分会管理</h3>
</div>
{if !empty($msg)}
<div class="condition">
    {$msg}
</div>
{/if}
<div class="table_zone">
    <form method="post" action="" enctype="multipart/form-data">
        <table class="modifytable">
            <tr>
                <td width="100px">分会名称</td>
                <td>
                    <select name="name">
                        {foreach from=$allnames item=v}
                        <option value="{$v}" {if $c_name eq $v}selected{/if}>{$v}</option>
                        {/foreach}
                    </select>
                    <span></span>
                    <a href="javascript:;" onclick="addt(this)">添加</a>
                </td>
            </tr><tr>
                <td>介绍</td>
                <td><textarea name="describe" style="width:650px;height:600px;"></textarea></td>
            </tr>
            <tr>
                <td style="text-align: center" colspan="2"><input type="submit" value="提交"/></td>
            </tr>
        </table>
    </form>
</div>
{literal}
<script>
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create("[name='describe']",{
            uploadJson: "/ajax/upload"
        });
    });
    $(document).ready(function(){
        $("[name='name']").change(function(){
            $.getJSON("/admin/placeforone?name="+$(this).val(), function(d){
                if(d.length == 0){
                    d ={"describe":"", "remar":""}; 
                }
                editor.html(d.describe);
            })
        }).change();
    })
    function addt(t){
        $(t).siblings("span").html("<input type='text'/>").find("input").focus().focusout(function(){
            v = $(this).val();
            if(v == ''){
                $(this).parent().html("");
                return;
            }else{
                $(t).siblings("select").append("<option value='"+v+"'>"+v+"</option>").val(v).change();
                $(this).parent().html("");
            }
        })
    }
</script>
{/literal}
{include file="admin/footer.html"}